package com.soker.page;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Component
public class Page<T> {
    private int pc;//当前页码
    private int tr;//总记录数
    private int ps;//每页记录数
    private String url;//请求路径和参数
    private List<T> beanList;
    //计算总页数
    public int getTp() {
        int tp = tr / ps;
        return tr % ps ==0? tp : tp+1;
    }
}
